﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IDAL;
using DAL;
using Models;

namespace BLL
{
    public class WorksPicInfoLogic
    {
        public static IWorksPicInfo workspicinfo = new WorksPicInfoDAL();

        public static List<WorksPicInfo> GetWorkAllPicInfo(int WorksID)
        {
            List<WorksPicInfo> list = new List<WorksPicInfo>();
            list = workspicinfo.GetWorkAllPicInfo(WorksID);
            return list;
        }
        /// <summary>
        /// 所有的picinfo，包括top=1的
        /// </summary>
        /// <param name="WorksID"></param>
        /// <returns></returns>
        public static List<WorksPicInfo> GetAllWorksPicInfo(int WorksID)
        {
            List<WorksPicInfo> list = new List<WorksPicInfo>();
            List<WorksPicInfo> oldlist = workspicinfo.GetWorkAllPicInfo(WorksID);
            list.Add(workspicinfo.GetTopOneWorksPics(WorksID));
            foreach (var item in oldlist)
            {
                list.Add(item);
            }
            return list;
        }
        public static int AddWorksPicInfo(WorksPicInfo pic)
        {
            return workspicinfo.AddWorksPicInfo(pic);
        }
        public static WorksPicInfo GetOnePicInfo(int PicID)
        {
            return workspicinfo.GetOneWorksPicInfo(PicID);
        }
        public static int DeletePicInfo(int PicID)
        {
            return workspicinfo.DeleteWorksPicInfo(PicID);
        }
        public static WorksPicInfo GetOnePicInfoFromURL(string URL)
        {
            return workspicinfo.GetOneWorksPicInfoFromURL(URL);
        }
        public static int UpdatePicInfo(WorksPicInfo pic)
        {
            return workspicinfo.UpdateWorksPicInfo(pic);
        }
    }
}
